package common.hua.com.timeview;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.hua.common.BaseActivity;
import com.hua.common.commonview.timeview.TimelineView;

import common.hua.com.myapplication.R;

/**
 * Created by huaxiaolin_pc on 2015/12/28.
 */
public class TimeViewActivity extends BaseActivity {

    private ListView listView=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentViewItem(R.layout.timeview_layout);
        this.listView= (ListView) this.findViewById(R.id.listview);
        this.listView.setAdapter(new MyAdapter());
        this.setPageTitle("时间轴");
    }


    class MyAdapter extends BaseAdapter{

        @Override
        public int getCount() {
            return 20;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Holder holder=null;
            if(convertView==null){
                convertView=  LayoutInflater.from(TimeViewActivity.this).inflate(R.layout.timeview_item,null);
                holder=new Holder();
                holder.name= (TextView) convertView.findViewById(R.id.name);
                holder.timelineView= (TimelineView) convertView.findViewById(R.id.time_marker);
                convertView.setTag(holder);
            }else{
                holder= (Holder) convertView.getTag();
            }
            holder.name.setText("name"+position);
            return convertView;
        }
    }

    class Holder {
        TextView name;
        TimelineView timelineView=null;
    }




}
